package org.spark.sql.java.imooc;

import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SparkSession;
import org.spark.utils.FilePath;

/**
 * 功能概述:
 * Datetime:    2020/6/30   19:42
 * Author:   某人的目光
 */
public class SparkSessionApp {

    public static void main(String[] args) {
        SparkSession sparkSession = SparkSession.builder().
                appName("SparkSessionApp").
                master("local").
                getOrCreate();

        Dataset<Row> df = sparkSession.read().format("json").load(FilePath.STUDENT_PATH);

        df.show();
        // +----+-------+
        // | age|   name|
        // +----+-------+
        // |null|Michael|
        // |  30|   Andy|
        // |  19| Justin|
        // +----+-------+

        sparkSession.close();
    }
}
